home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Prog / T / Think-Pascal-7.0.cpt / THINK Pascal Interfaces / SoundInput.p < prev    next >
Encoding:
Text File  |  1991-04-03  |  5.9 KB  |  174 lines  |  [TEXT/PJMM]

  1. {    This file has been processed by The THINK Pascal Source Converter, v1.1.    }
  2.  
  3. {}
  4. {Created: Wednesday, June 27, 1990 at 6:42 PM}
  5. {    SoundInput.p}
  6. {    Pascal Interface to the Macintosh Libraries}
  7. {}
  8. {        Copyright Apple Computer, Inc. 1989-1990}
  9. {        All rights reserved}
  10. {}
  11.  
  12.  
  13. {$IFC UNDEFINED UsingIncludes}
  14. {$SETC UsingIncludes := 0}
  15. {$ENDC}
  16.  
  17.  
  18. unit SoundInput;
  19. interface
  20.     uses
  21.         Types, OSUtils, Dialogs, Files;
  22.  
  23.     const
  24.  
  25.         siDeviceIsConnected = 1;                { input device is connected and ready for input }
  26.         siDeviceNotConnected = 0;                { input device is not connected }
  27.         siDontKnowIfConnected = -1;                { can't tell if input device is connected }
  28.  
  29.         siReadPermission = 0;                { permission passed to SPBOpenDevice }
  30.         siWritePermission = 1;                { permission passed to SPBOpenDevice }
  31.  
  32. { Info Selectors for Sound Input Drivers }
  33.  
  34.         siDeviceConnected = 'dcon';            { input device connection status }
  35.         siAGCOnOff = 'agc ';            { automatic gain control state }
  36.         siPlayThruOnOff = 'plth';            { playthrough state }
  37.         siTwosComplementOnOff = 'twos';            { two's complement state }
  38.         siLevelMeterOnOff = 'lmet';            { level meter state }
  39.         siRecordingQuality = 'qual';            { recording quality }
  40.         siVoxRecordInfo = 'voxr';            { VOX record parameters }
  41.         siVoxStopInfo = 'voxs';            { VOX stop parameters }
  42.         siNumberChannels = 'chan';            { current number of channels }
  43.         siSampleSize = 'ssiz';            { current sample size }
  44.         siSampleRate = 'srat';            { current sample rate }
  45.         siCompressionType = 'comp';            { current compression type }
  46.         siCompressionFactor = 'cmfa';            { current compression factor }
  47.         siCompressionHeader = 'cmhd';            { return compression header }
  48.         siDeviceName = 'name';            { input device name }
  49.         siDeviceIcon = 'icon';            { input device icon }
  50.         siDeviceBufferInfo = 'dbin';            { size of interrupt buffer }
  51.         siSampleSizeAvailable = 'ssav';            { sample sizes available }
  52.         siSampleRateAvailable = 'srav';            { sample rates available }
  53.         siCompressionAvailable = 'cmav';            { compression types available }
  54.         siChannelAvailable = 'chav';            { number of channels available }
  55.         siAsync = 'asyn';            { asynchronous capability }
  56.         siOptionsDialog = 'optd';            { display options dialog }
  57.         siContinuous = 'cont';            { continous recording }
  58.         siActiveChannels = 'chac';            { active channels }
  59.         siActiveLevels = 'lmac';            { active meter levels }
  60.         siInitializeDriver = 'init';            { reserved for internal use only }
  61.         siCloseDriver = 'clos';            { reserved for internal use only }
  62.         siPauseRecording = 'paus';            { reserved for internal use only }
  63.         siUserInterruptProc = 'user';            { reserved for internal use only }
  64.  
  65. { Qualities }
  66.  
  67.         siBestQuality = 'best';
  68.         siBetterQuality = 'betr';
  69.         siGoodQuality = 'good';
  70.  
  71.  
  72.     type
  73.  
  74.         SPBPtr = ^SPB;
  75.         SPB = record
  76.                 inRefNum: LONGINT;            { reference number of sound input device }
  77.                 count: LONGINT;            { number of bytes to record }
  78.                 milliseconds: LONGINT;            { number of milliseconds to record }
  79.                 bufferLength: LONGINT;            { length of buffer in bytes }
  80.                 bufferPtr: Ptr;                { buffer to store sound data in }
  81.                 completionRoutine: ProcPtr;            { completion routine }
  82.                 interruptRoutine: ProcPtr;            { interrupt routine }
  83.                 userLong: LONGINT;            { user-defined field }
  84.                 error: OSErr;                { error }
  85.                 unused1: LONGINT;            { reserved - must be zero }
  86.             end;
  87.  
  88.  
  89.     function SPBVersion: NumVersion;
  90.     inline
  91.         $203C, $0000, $0014, $A800;
  92.  
  93.     function SndRecord (filterProc: ModalFilterProcPtr; corner: Point; quality: OSType; var sndHandle: Handle): OSErr;
  94.     inline
  95.         $203C, $0804, $0014, $A800;
  96.  
  97.     function SndRecordToFile (filterProc: ModalFilterProcPtr; corner: Point; quality: OSType; fRefNum: INTEGER): OSErr;
  98.     inline
  99.         $203C, $0708, $0014, $A800;
  100.  
  101.     function SPBSignInDevice (deviceRefNum: INTEGER; deviceName: Str255): OSErr;
  102.     inline
  103.         $203C, $030C, $0014, $A800;
  104.  
  105.     function SPBSignOutDevice (deviceRefNum: INTEGER): OSErr;
  106.     inline
  107.         $203C, $0110, $0014, $A800;
  108.  
  109.     function SPBGetIndexedDevice (count: INTEGER; var deviceName: Str255; var deviceIconHandle: Handle): OSErr;
  110.     inline
  111.         $203C, $0514, $0014, $A800;
  112.  
  113.     function SPBOpenDevice (deviceName: Str255; permission: INTEGER; var inRefNum: LONGINT): OSErr;
  114.     inline
  115.         $203C, $0518, $0014, $A800;
  116.  
  117.     function SPBCloseDevice (inRefNum: LONGINT): OSErr;
  118.     inline
  119.         $203C, $021C, $0014, $A800;
  120.  
  121.     function SPBRecord (inParamPtr: SPBPtr; asynchFlag: BOOLEAN): OSErr;
  122.     inline
  123.         $203C, $0320, $0014, $A800;
  124.  
  125.     function SPBRecordToFile (fRefNum: INTEGER; inParamPtr: SPBPtr; asynchFlag: BOOLEAN): OSErr;
  126.     inline
  127.         $203C, $0424, $0014, $A800;
  128.  
  129.     function SPBPauseRecording (inRefNum: LONGINT): OSErr;
  130.     inline
  131.         $203C, $0228, $0014, $A800;
  132.  
  133.     function SPBResumeRecording (inRefNum: LONGINT): OSErr;
  134.     inline
  135.         $203C, $022C, $0014, $A800;
  136.  
  137.     function SPBStopRecording (inRefNum: LONGINT): OSErr;
  138.     inline
  139.         $203C, $0230, $0014, $A800;
  140.  
  141.     function SPBGetRecordingStatus (inRefNum: LONGINT; var recordingStatus: INTEGER; var meterLevel: INTEGER; var totalSamplesToRecord: LONGINT; var numberOfSamplesRecorded: LONGINT; var totalMsecsToRecord: LONGINT; var numberOfMsecsRecorded: LONGINT): OSErr;
  142.     inline
  143.         $203C, $0E34, $0014, $A800;
  144.  
  145.     function SPBGetDeviceInfo (inRefNum: LONGINT; infoType: OSType; infoData: Ptr): OSErr;
  146.     inline
  147.         $203C, $0638, $0014, $A800;
  148.  
  149.     function SPBSetDeviceInfo (inRefNum: LONGINT; infoType: OSType; infoData: Ptr): OSErr;
  150.     inline
  151.         $203C, $063C, $0014, $A800;
  152.  
  153.     function SPBMillisecondsToBytes (inRefNum: LONGINT; var milliseconds: LONGINT): OSErr;
  154.     inline
  155.         $203C, $0440, $0014, $A800;
  156.  
  157.     function SPBBytesToMilliseconds (inRefNum: LONGINT; var byteCount: LONGINT): OSErr;
  158.     inline
  159.         $203C, $0444, $0014, $A800;
  160.  
  161.     function SetupSndHeader (sndHandle: Handle; numChannels: INTEGER; sampleRate: Fixed; sampleSize: INTEGER; compressionType: OSType; baseNote: INTEGER; numBytes: LONGINT; var headerLen: INTEGER): OSErr;
  162.     inline
  163.         $203C, $0D48, $0014, $A800;
  164.  
  165.     function SetupAIFFHeader (fRefNum: INTEGER; numChannels: INTEGER; sampleRate: Fixed; sampleSize: INTEGER; compressionType: OSType; numBytes: LONGINT; numFrames: LONGINT): OSErr;
  166.     inline
  167.         $203C, $0B4C, $0014, $A800;
  168.  
  169.     { UsingSoundInput }
  170.  
  171.  
  172. implementation
  173. end.
  174.